package rladidxo.basic;

public class J02_Charge {
	public static void main(String[] args) {
		int pay;
		int charge;
		int w10;
		int w50;
		int w100;
		int w500;
		int w1000;
		int w5000;
		int w10000;
		int w50000;
		int rest;

//		charge = 876543210;
		charge = 8_7654_3210; // JDK7, 자릿수구분 _

		w50000 = charge / 50000;

		rest = charge - (w50000 * 50000);
		w10000 = rest / 10000;

		rest = rest - (w10000 * 10000);
		w5000 = rest / 5000;

		rest = rest - (w5000 * 5000);
		w1000 = rest / 1000;

		rest = rest - (w1000 * 1000);
		w500 = rest / 500;

		rest = rest - (w500 * 500);
		w100 = rest / 100;

		rest = rest - (w100 * 100);
		w50 = rest / 50;

		rest = rest - (w50 * 50);
		w10 = rest / 10;

		rest = rest - (w10 * 10);

		System.out.println(charge + "원은");
		System.out.println();
		System.out.println( "5만원짜리" + w50000 + "개");
		System.out.println();
		System.out.println("만원짜리" + w10000 + "개");
		System.out.println();
		System.out.println("오천원짜리" + w5000 + "개");
		System.out.println();
		System.out.println("천원짜리" + w1000 + "개");
		System.out.println();
		System.out.println("오백원짜리" + w500 + "개");
		System.out.println();
		System.out.println("백원짜리" + w100 + "개");
		System.out.println();
		System.out.println("오십원짜리" + w50 + "개");
		System.out.println();
		System.out.println("십원짜리" + w10 + "개가 필요합니다.^^");

	}

}
